<!DOCTYPE HTML>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,width=device-width,initial-scale=1.0"/>
    <meta name="format-detection" content="telephone=no,email=no,date=no,address=no">
    <title>牧心农业</title>
    <link rel="stylesheet" type="text/css" href="/static/css/eui.css" />
    <link rel="stylesheet" type="text/css" href="/static/css/mobile.css" />
    <link rel="stylesheet" type="text/css" href="/static/css/iconfont.css" />
    <script src="/static/js/jquery.min.js"></script>
    <script src="/static/js/doT.min.js"></script>
    <script src="/static/js/func.js"></script>
</head>
<body>
    <div class="content margin_top">
        <header class="header fixed_top bg_mx_green"></header>
        <div class="font_16 margin_b_10 bg_white lineheight_4 text_center flex title_nav">
            <div class="flex_1 <{if is_null($status)}>active_border<{/if}>"><a href="<{url route='/business/user/pork-order/index'}>">全部</a></div>
            <div class="flex_1 <{if $status==='0'}>active_border<{/if}>"><a href="<{url route='/business/user/pork-order/index?status=0'}>">待付款</a></div>
            <div class="flex_1 <{if $status==1}>active_border<{/if}>"><a href="<{url route='/business/user/pork-order/index?status=1'}>">待发货</a></div>
            <div class="flex_1 <{if $status==2}>active_border<{/if}>"><a href="<{url route='/business/user/pork-order/index?status=2'}>">待收货</a></div>
            <div class="flex_1 <{if $status==3}>active_border<{/if}>"><a href="<{url route='/business/user/pork-order/wait-comment'}>">待评价</a></div>
        </div>
        <div class="order_list"></div>
    </div>
    <script type="text/template" charset="utf-8" id='order_template'></script>
    <script>
        // 页面初始化
            var order_list = <{$orderlist}>;console.log(order_list);
            loadorder(order_list);
            loadheadbar("订单管理");
        // 取消订单
            function quit_order(n){
                $.post("/business/user/pork-order/cancal",{id:n,_csrf:'<{$app->request->csrfToken}>'},function(res){
                    alert(res.msg);
                    if(res.status==0){
                        window.location.reload()
                    }
                },"json")
            }
        // 支付
            function pay_order(n){
//                $.post("",{id:n,_csrf:'<{$app->request->csrfToken}>'},function(res){
//
//                },"json")
                  location.href='/pay/wechat/pay/index?oid='+n;
            }
        // 确认收货
            function confirm_order(n){
                $.post("/business/user/pork-order/receive",{id:n,_csrf:'<{$app->request->csrfToken}>'},function(res){
                    alert(res.msg);
                    if(res.status==0){
                        window.location.href='/business/user/pork-order/wait-comment';
                    }
                },"json")
            }
        // 评价
            function comment_order(n,oid){
                 location.href = "/shop/goods/comment?id="+n+'&oid='+oid;
            }
    </script>
</body>
</html>
